<template>
  <div>
    <cus-modal
      ref="modal"
      title="副食和燃油定量"
      cancelBtnName="关闭"
      :showOkBtn="false"
      @on-visible-change="onVisibleChange"
      width="90"
      marginTop="40px"
      @onOk="onOk"
    >
      <Table border :loading="loading" :columns="columns" :data="data">
        <template slot-scope="{ row, index }" slot="project">
          <div class="slotBox" v-if="data[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data[index].value.length }"
            >
              <div style="width:100%">
                <div v-if="item.id == 1">一类灶</div>
                <div v-if="item.id == 2">二类灶</div>
                <div v-if="item.id == 3">三类灶</div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="meat">
          <div class="slotBox" v-if="data[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardMeat }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.meat"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.meat }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="poultry">
          <div class="slotBox" v-if="data[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardPoultry }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.poultry"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.poultry }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="eggs">
          <div class="slotBox" v-if="data[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardEggs }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.eggs"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.eggs }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="fish">
          <div class="slotBox" v-if="data[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardFish }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.fish"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.fish }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="milk">
          <div class="slotBox" v-if="data[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardMilk }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.milk"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.milk }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="soybean">
          <div class="slotBox" v-if="data[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardSoybean }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.soybean"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.soybean }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="sucrose">
          <div class="slotBox" v-if="data[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardSucrose }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.sucrose"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.sucrose }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="vegetableOil">
          <div class="slotBox" v-if="data[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardVegetableOil }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.vegetableOil"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.vegetableOil }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="vegetables">
          <div class="slotBox" v-if="data[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardVegetables }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.vegetables"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.vegetables }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="fruits">
          <div class="slotBox" v-if="data[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardFruits }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.fruits"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.fruits }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="edibleFungi">
          <div class="slotBox" v-if="data[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardEdibleFungi }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.edibleFungi"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.edibleFungi }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="operation">
          <div class="slotBox">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data[index].value.length }"
            >
              <div class="flex">
                <cus-button
                  type="text"
                  size="small"
                  :style="{ color: '#1E6FFF', padding: '0 8px' }"
                  @onClick="item.isEdit = !item.isEdit"
                  v-if="item.isEdit == false"
                >
                  编辑
                </cus-button>
                <cus-button
                  type="text"
                  size="small"
                  :style="{ color: 'gray', padding: '0 8px' }"
                  @onClick="
                    item.isEdit = false;
                    foodAndFuelApi();
                  "
                  v-if="item.isEdit == true"
                >
                  取消
                </cus-button>
                <cus-button
                  type="text"
                  size="small"
                  :style="{ color: 'green', padding: '0 8px' }"
                  @onClick="saveChange(item)"
                  v-if="item.isEdit == true"
                >
                  保存
                </cus-button>
              </div>
            </div>
          </div>
        </template>
      </Table>
      <Table border :loading="loading" :columns="columns2" :data="data2">
        <template slot-scope="{ row, index }" slot="project">
          <div class="slotBox" v-if="data2[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data2[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data2[index].value.length }"
            >
              <div style="width:100%">
                <div v-if="item.id == 1">一类灶</div>
                <div v-if="item.id == 2">二类灶</div>
                <div v-if="item.id == 3">三类灶</div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="dried">
          <div class="slotBox" v-if="data2[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data2[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data2[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardDried }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.dried"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.dried }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="chocolates">
          <div class="slotBox" v-if="data2[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data2[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data2[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardChocolates }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.chocolates"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.chocolates }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="vitamin">
          <div class="slotBox" v-if="data2[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data2[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data2[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardVitamin }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.vitamin"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.vitamin }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="drinks">
          <div class="slotBox" v-if="data2[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data2[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data2[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardDrinks }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.drinks"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.drinks }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="seasonings">
          <div class="slotBox" v-if="data2[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data2[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data2[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardSeasonings }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.seasonings"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.seasonings }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="coalBurning">
          <div class="slotBox" v-if="data2[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data2[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data2[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardCoalBurning }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.coalBurning"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.coalBurning }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="pipelineGas">
          <div class="slotBox" v-if="data2[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data2[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data2[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardPipelineGas }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.pipelineGas"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.pipelineGas }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="naturalGas">
          <div class="slotBox" v-if="data2[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data2[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data2[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardNaturalGas }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.naturalGas"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.naturalGas }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="plateauFuel">
          <div class="slotBox" v-if="data2[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data2[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data2[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardPlateauFuel }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.plateauFuel"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.plateauFuel }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="borderFuel">
          <div class="slotBox" v-if="data2[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data2[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data2[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardBorderFuel }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.borderFuel"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.borderFuel }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>
        <template slot-scope="{ row, index }" slot="liquidGas">
          <div class="slotBox" v-if="data2[index].value">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data2[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data2[index].value.length }"
            >
              <div style="width:100%;text-align:left;padding:0 10px">
                <div>推荐：{{ item.standardLiquidGas }}</div>
                <div style="display:flex;align-items:center">
                  <div>标准：</div>
                  <InputNumber
                    :min="0"
                    :max="10000"
                    :precision="0"
                    v-model="item.liquidGas"
                    v-if="item.isEdit"
                  ></InputNumber>
                  <div v-else>{{ item.liquidGas }}</div>
                </div>
              </div>
            </div>
          </div>
        </template>

        <template slot-scope="{ row, index }" slot="operation">
          <div class="slotBox">
            <div
              class="slotBox-item"
              v-for="(item, idx) in data2[index].value"
              :key="idx"
              :class="{ noBorderB: idx + 1 == data2[index].value.length }"
            >
              <div class="flex">
                <cus-button
                  type="text"
                  size="small"
                  :style="{ color: '#1E6FFF', padding: '0 8px' }"
                  @onClick="item.isEdit = !item.isEdit"
                  v-if="item.isEdit == false"
                >
                  编辑
                </cus-button>
                <cus-button
                  type="text"
                  size="small"
                  :style="{ color: 'gray', padding: '0 8px' }"
                  @onClick="
                    item.isEdit = false;
                    foodAndFuelApi();
                  "
                  v-if="item.isEdit == true"
                >
                  取消
                </cus-button>
                <cus-button
                  type="text"
                  size="small"
                  :style="{ color: 'green', padding: '0 8px' }"
                  @onClick="saveChange(item)"
                  v-if="item.isEdit == true"
                >
                  保存
                </cus-button>
              </div>
            </div>
          </div>
        </template>
      </Table>
      <div style="color:gray;margin-top:10px">
        * 提示：修改标准若带有小数，将自动取整。
      </div>
    </cus-modal>
  </div>
</template>

<script>
import { foodAndFuel, saveFoodAndFuel } from "@/api/business/dishesModule";

export default {
  data() {
    return {
      columns: [
        {
          title: "",
          key: "name",
          align: "center"
        },
        {
          title: "类别",
          slot: "project",
          align: "center"
        },
        {
          slot: "meat",
          align: "center",
          title: "",
          renderHeader: (h, params) => {
            let text = "畜肉 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "poultry",
          align: "center",
          renderHeader: (h, params) => {
            let text = "禽肉 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "eggs",
          align: "center",
          renderHeader: (h, params) => {
            let text = "禽蛋 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "fish",
          align: "center",
          renderHeader: (h, params) => {
            let text = "鱼虾 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "milk",
          align: "center",
          renderHeader: (h, params) => {
            let text = "牛奶 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "soybean",
          align: "center",
          renderHeader: (h, params) => {
            let text = "大豆 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "sucrose",
          align: "center",
          renderHeader: (h, params) => {
            let text = "蔗糖 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "vegetableOil",
          align: "center",
          renderHeader: (h, params) => {
            let text = "植物油 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "vegetables",
          align: "center",
          renderHeader: (h, params) => {
            let text = "蔬菜 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "fruits",
          align: "center",
          renderHeader: (h, params) => {
            let text = "水果 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "edibleFungi",
          align: "center",
          title: "",
          renderHeader: (h, params) => {
            let text = "食用菌 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          title: "操作",
          width: 150,
          fixed: "right",
          slot: "operation",
          align: "center"
        }
      ],
      columns2: [
        {
          title: "",
          key: "name",
          align: "center"
        },
        {
          title: "类别",
          slot: "project",
          align: "center"
        },
        {
          slot: "dried",
          align: "center",
          renderHeader: (h, params) => {
            let text = "干菜 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "chocolates",
          align: "center",
          renderHeader: (h, params) => {
            let text = "巧克力 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "vitamin",
          align: "center",
          renderHeader: (h, params) => {
            let text = "维生素 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "drinks",
          align: "center",
          renderHeader: (h, params) => {
            let text = "饮料 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "seasonings",
          align: "center",
          renderHeader: (h, params) => {
            let text = "调料类 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "coalBurning",
          align: "center",
          renderHeader: (h, params) => {
            let text = "燃煤 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "pipelineGas",
          align: "center",
          renderHeader: (h, params) => {
            let text = "管道煤气 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "naturalGas",
          align: "center",
          renderHeader: (h, params) => {
            let text = "管道天然气 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "liquidGas",
          align: "center",
          renderHeader: (h, params) => {
            let text = "罐装石油液化气 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "plateauFuel",
          align: "center",
          renderHeader: (h, params) => {
            let text = "高原部队燃油 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          slot: "borderFuel",
          align: "center",
          renderHeader: (h, params) => {
            let text = "边防岛屿部队燃油 <br/> 推荐 / 标准";
            return h("div", {
              domProps: {
                innerHTML: text
              }
            });
          }
        },
        {
          title: "操作",
          width: 150,
          fixed: "right",
          slot: "operation",
          align: "center"
        }
      ],
      data: [
        {
          name: "副食和燃油定量",
          isEdit: false,
          value: []
        }
      ],
      data2: [
        {
          name: "副食和燃油定量",
          isEdit: false,
          value: []
        }
      ],
      loading: false
    };
  },
  mounted() {
    // this.form = this.$cu.deepClone(form);
  },
  methods: {
    onVisibleChange(v) {
      if (!v) {
        // this.form = this.$cu.deepClone(form)
      }
    },
    show() {
      this.$refs["modal"].show = true;
      this.foodAndFuelApi();
    },
    onOk() {},
    // 保存
    saveChange(item) {
      console.log(item);
      this.loading = true;
      return new Promise(resolve => {
        saveFoodAndFuel(item).then(res => {
          this.loading = false;
          if (res.retCode === 2000) {
            this.$Message.success("修改成功.");
            this.foodAndFuelApi();
            resolve();
          }
        });
      });
    },
    // 查询定量标准
    foodAndFuelApi() {
      this.loading = true;
      this.data[0].value = [];
      this.data2[0].value = [];

      return new Promise(resolve => {
        foodAndFuel({}).then(res => {
          this.loading = false;
          if (res.retCode === 2000) {
            this.data[0].value = res.data.map(item => {
              item.isEdit = false;
              return item;
            });
            this.data2[0].value = this.$cu.deepClone(this.data[0].value);
            resolve();
          }
        });
      });
    }
  }
};
</script>
<style scoped>
/deep/.ivu-table-cell {
  padding-left: 0 !important;
  padding-right: 0 !important;
}
</style>
<style scoped lang="less">
.slotBox {
  width: 100%;
  // padding: 5px 0;
  &-item {
    padding: 10px 0;
    border-bottom: 1px solid #e3e8ee;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.noBorderB {
  border-bottom: none !important;
}
</style>
